SRCS= $(wildcard *.cpp)
LIBNAME= include
INCDIR= .
DEFINES= 
include Makefile.config
include Makefile.template

MAKE = make -j 2
SUB_LIBS = . utils math math3d camera GLdraw  optimization geometry meshing image Robotics


all: lib PQP
	 cd utils; $(MAKE)
	 cd math; $(MAKE)
	 cd math3d; $(MAKE)
	 cd camera; $(MAKE)
	 cd GLdraw; $(MAKE)
	 cd optimization; $(MAKE)
	 cd geometry; $(MAKE)
	 cd meshing; $(MAKE)
	 cd image; $(MAKE)
	 cd Robotics; $(MAKE)
	 $(AR) rcs $(LIBDIROUT)/libKrisLibrary.a $(wildcard $(addsuffix /$(OBJDIR)/*.o,$(SUB_LIBS))) $(KRISLIBRARY_EXTRAOBJS)
	 $(RANLIB) $(LIBDIROUT)/libKrisLibrary.a

KrisLibrary: 
	 $(AR) rcs $(LIBDIROUT)/libKrisLibrary.a $(wildcard $(addsuffix /$(OBJDIR)/*.o,$(SUB_LIBS))) $(KRISLIBRARY_EXTRAOBJS)
	 $(RANLIB) $(LIBDIROUT)/libKrisLibrary.a

PQP:
	cd geometry/PQP; make

docs:
	 doxygen doxygen.conf

clean:
	-rm -f $(DEPDIR)/*.d $(OBJDIR)/*.o $(LIBDIROUT)/*.a; 
	-rmdir $(DEPDIR) $(OBJDIR) $(LIBDIROUT)
	-cd utils; make clean
	-cd math; make clean
	-cd math3d; make clean
	-cd camera; make clean
	-cd GLdraw; make clean
	-cd optimization; make clean
	-cd geometry; make clean
	-cd meshing; make clean
	-cd image; make clean
	-cd statistics; make clean
	-cd Robotics; make clean

package:
	zip KrisLibrary.zip readme.txt
	zip KrisLibrary.zip Makefile Makefile.config Makefile.template
	zip KrisLibrary.zip doxygen.conf
	zip KrisLibrary.zip $(addsuffix /Makefile,$(SUB_LIBS))
	zip KrisLibrary.zip $(addsuffix /*.h,$(SUB_LIBS))
	zip KrisLibrary.zip $(addsuffix /*.cpp,$(SUB_LIBS))
